package com.jason.exception;

import com.jason.constant.ResponseConstant;
import com.jason.vo.Response;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
@ResponseBody
public class ExceptionsHandler {

    @ExceptionHandler(value = Exception.class)
    public Response handleException(Exception ex) {
        Response response = new Response();
        response.setCode(ResponseConstant.FAILED);
        response.setMessage(ex.getMessage());
        return response;
    }
}
